﻿$(function () {
    getList(1);
    $("#searchBtn").click(function () {
        getList(1);
    });
});

function getList(pageIndex) {
    try {
        var keyword = $("#keyword").val();
        var str = objectJS.getAritcleList(pageIndex, 10, keyword);
        //$("body").prepend(str);
        var list = JSON.parse(str);

        $("#list").html(null != list.Data && list.Data.length > 0 ? template("tplList", { data: list.Data }) :
            '<tr><td colspan="6" class="text-center data-null">暂无数据</td></tr>');

        laypage({
            cont: "pageDiv",
            pages: list.PageCount,
            count: list.Total,
            skin: "molv",
            curr: list.PageNo,
            first: 1,
            last: list.PageCount || !1,
            prev: "上一页",
            next: "下一页",
            skip: !0,
            jump: function (a, t) {
                t || getList(a.curr)
            }
        })

    } catch (e) {
        layer.msg(e.message);
    }
}